home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
- From: Dan Pop <danpop@mail.cern.ch>
- Newsgroups: comp.lang.c
- Subject: Re: void main() and other atrocities!
- Date: Fri, 2 Feb 1996 14:00:22 +0100
- Organization: CERN European Lab for Particle Physics
- Message-ID: <9602021300.AA04359@dxmint.cern.ch>
- References: <4eduaj$1aq@grouper.Exis.Net> <4em17r$shq@jaxnet.jaxnet.com> <4emub9$1mo@fountain.mindlink.net> <4epplj$egf@host-3.cyberhighway.net> <4erjn2INN38b@keats.ugrad.cs.ubc.ca>
- X-NNTP-Posting-Host: hpl3sn03.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
- X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
-
- c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku) writes:
-
- >There is nothing with 'void main()'. It's not giverned by the ANSI standard,
- >first of all, because that is not an ANSI definition. An ANSI definiton would
- >be more like 'void main(void)'.
-
- 'void foo()' and 'void foo(void)' are 100% equivalent as function
- _definitions_ in ANSI C. They're different only when used as function
- _declarations_ (one is a prototype, the other isn't).
-
- >You don't need main() to be defined has having any sort of return value unless
- >you plan to "return" out of it. If you use exit(0) like me, declaring the
- >function void is ok, since your function never returns.
-
- BULLSHIT. Please read the FAQ before posting such nonsense.
-
- AxCrnA$ cc test.c
-
- void main() {exit(0);}
- .....^
- %CC-E-NEEDNONVOID, In this statement, "main(...)" has void type, but occurs
- in a context that requires a non-void result.
- at line number 2 in file DISK$L32:[DANPOP]TEST.C;3
-
- Dan
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-